package com.lxz.jucdemo.assist;

import java.util.concurrent.CountDownLatch;

/**
 * @Author: 刘新智
 * @Date: 2025/10/26 10:01
 * @Description: 减法计数器
 * @Version: v1.0
 */
public class CountDownLatchTest {
    public static void main(String[] args) throws InterruptedException {
        CountDownLatch countDownLatch = new CountDownLatch(6);
        for (int i = 1; i <=6 ; i++) {
            new Thread(()->{
                System.out.println(Thread.currentThread().getName()+":Going");
                countDownLatch.countDown();
            },String.valueOf(i)).start();
        }
        countDownLatch.await();// 阻塞
        System.out.println("Close Door");
    }
}
